package com.yilifang.config.handler;

import com.yilifang.config.result.Result;
import com.yilifang.config.result.ResultGenerator;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * Created by zhuan on 2018-07-01.
 */
@ControllerAdvice
public class MyExceptionHandler {


    @ExceptionHandler(value = Exception.class)
    public static Result ExceptionHandle(Exception e) {
        e.printStackTrace();
        return ResultGenerator.genFailResult(e.getMessage());
    }
}
